// @algorithm @lc id=100323 lang=cpp
// @title ba-shu-zu-pai-cheng-zui-xiao-de-shu-lcof

#include "algm/algm.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;

class Solution {
public:
    string minNumber(vector<int> &nums) {
        vector<string> strs;
        for (int i = 0; i < (int)nums.size(); i++) {
            strs.push_back(to_string(nums[i]));
        }
        sort(strs.begin(), strs.end(), compare);
        string res;
        for (string s : strs)
            res.append(s);
        return res;
    }

private:
    static bool compare(const string &s1, const string &s2) {
        return s1 + s2 < s2 + s1;
    }
};
